;数据段
datas SEGMENT
    inputer db 'please input a string: $'
    arr db 40,0,40 dup(?)
datas ENDS

;堆栈段
stacks SEGMENT
    db 100 dup(0)
stacks ENDS

crlf MACRO
    mov dl,0ah
    mov ah,2
    int 21h
    mov dl,0dh
    mov ah,2
    int 21h
ENDM

;代码段
codes SEGMENT
    assume cs:codes,ds:datas,ss:stacks
start:
    mov ax,datas
    mov ds,ax

    ;输入提示
    lea dx,inputer
    mov ah,9
    int 21h

    lea dx,arr
    mov ah,10
    int 21h

    crlf

    mov bx,0

lp:
    cmp arr[bx+2],20h
    jl exit
    cmp arr[bx+2],'a'
    jl next
    cmp arr[bx+2],'z'
    jg next
    sub arr[bx+2],20h
    mov dl,arr[bx+2]
    mov ah,2
    int 21h
    inc bx
    jmp lp

next:
    mov dl,arr[bx+2]
    mov ah,2
    int 21h
    inc bx
    jmp lp


exit:
    mov ah,4ch
    int 21h
codes ENDS
    end start